<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<fmt:setBundle basename="ApplicationResources" />
<script language="javascript" type="text/javascript"
	src="../script/datetimepicker.js"></script>
	 
	 <script type="text/javascript" src="../script/jquery.js"></script>
<script type="text/javascript">
<!--



	
	function Popup(val) {
		var URL = "${pageContext.request.contextPath}/controller/" + val;
		window.open(URL, "myWindow",
				"status = 1, height = 300, width = 300, resizable = 0");
		
	}
	
	function validateCreate(){
		var isValid = true;
		var aa = $("#programName").attr("value");
		if($("#programName").attr("value") == "" 
				|| $("#duration").attr("value") == ""
				|| $("#date").attr("value") == ""
				|| $("#time").attr("value") == ""
				|| $("#presentername").attr("value") == ""
				|| $("#producername").attr("value") == ""){
			document.getElementById("copyErrorMsg").innerHTML = "Please fill the required field!";
			document.getElementById("copyErrorMsg").setAttribute('style', 'color:red');
			isValid = false;
		}
		else
			{document.getElementById("copyErrorMsg").innerHTML = "";}
		return isValid;
	}	
</script>

<title><fmt:message key="label.crudschedule.add" /></title>
</head>

<body>
	<div style="color:red">${errorMessage}</div> 
	<form
		action="${pageContext.request.contextPath}/ScheduleController/createSchedule"
		method=post onSubmit="return validateCreate()">
			<table cellpadding=4 cellspacing=2 border=0>
				<tr>
					<td><fmt:message key="label.crudrp.name" />
					<td>
					<input type="hidden" id="programid" name="programid" readonly="readonly" />
					<input id="programName" type="text" name="programName" value="" size=25
						readonly=readonly maxlength=20>
						<a href="javascript:Popup('selectprogram');">select Program</a></td>
				</tr>
				<tr>
					<td><fmt:message key="label.crudschedule.duration" />
					</td>
					<td><input id="duration" type="text" name="duration" value=""
						size=25 maxlength=20 readonly="readonly" />
					</td>
				</tr>
				<tr>
					<td><fmt:message key="label.crudschedule.date" />
					</td>
					<td><input id="date" name="date" type="text" size="25"
						readonly="readonly"> <a
						href="javascript:NewCal('date','ddmmyyyy')"><img
							src="../img/cal.gif" width="16" height="16" border="0"
							alt="Pick a date" > </a>
					</td>
				</tr>
				<tr>
					<td><fmt:message key="label.crudschedule.time" />
					</td>
					
					<td><input id="time" name="time" type="text" size="25" readonly=readonly/> 
					</td>
				</tr>
				<tr>
					<td><fmt:message key="label.radioprogram.presenter" />
					</td>
					<td><input type="text" id="presentername" name="presentername" readonly="readonly" />
						<a href="javascript:Popup('presenter');">select presenter </a>
						<input type="hidden" id="presenterid" name="presenterid" readonly="readonly" />
						
						</td>
				</tr>
				<tr>
					<td><fmt:message key="label.radioprogram.producer" />
					</td>
					<td><input type="text" id="producername" name="producername" readonly="readonly" /> <a
						href="javascript:Popup('producer');">select producer</a>
						<input type="hidden" id="producerid" name="producerid" readonly="readonly" />
						</td>
				</tr>
			</table>
	
		
		<table><tr><td><input type="Submit" value="Save" onClick="return validateCreate()">
		</td><td><div id="copyErrorMsg"></div></td></tr></table>
	</form>
</body>
</html>